﻿@model BMCShowView.Portal.ViewModels.ArrangeViewModel
<!DOCTYPE html>

<html lang="zh-cn">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <base href="/Home/Index" />
    <title>排班页面</title>

    <link rel="stylesheet" href="~/Styles/global.css" />
    <link rel="stylesheet" href="~/Styles/Arrange.css" />
</head>
<body>
    <article id="top">
        <section>
            <header>
                <span>今日值班人员</span>
                <label>@Model.Now.ToString("yyyy年MM月dd日 dddd")</label>
            </header>
            <ul>
                <li><label>运行员：</label><span>@Model.Runner</span></li>
                <li><label>备注项：</label><span>@Model.Remark</span></li>
            </ul>
        </section>
    </article>
    <article id="bottom">
        <section>
            <header>今天重要作业</header>
            <ul>
                <li>@Model.Now.ToString("M月d日")</li>
                @foreach (var task in Model.ImportantTasks)
                {
                    <li>@task.StartTime.ToString(@"hh\:mm")--@task.EndTime.ToString(@"hh\:mm") @task.Information</li>
                }
            </ul>
        </section>
        <section>
            <header>通知公告</header>
            <ul>
                @if (Model.Announcement != null)
                {
                    foreach (var line in Model.Announcement.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        <li>@line</li>
                    }
                }
            </ul>



        </section>
    </article>
    <script src="~/Scripts/AutoScrollPage.js"></script>
    <script type="text/javascript">
        setAutoScrollPage(document.querySelector("#bottom section:first-child ul"));
        setAutoScrollPage(document.querySelector("#bottom section:last-child ul"));
        // 收到消息刷新
        new EventSource("Message").onmessage = function (e) {
            if (e.data === "Refresh") {
                location.reload();
            }
        };
        // 5分钟定时刷新
        window.setTimeout(function () {
            location.reload();
        }, 5 * 60 * 1000);
    </script>
</body>
</html>
